import React from 'react';

import Constants from '../../common/Constants';
import CommonSendFetchAction from '../common/CommonSendFetchAction';
import ResponseConstants from '../../common/ResponseConstants';

export default class ActivityLikeSingerAction extends CommonSendFetchAction {
  constructor() {
    super();

    this.moduleType = Constants.MODULE_TYPE.ACTIVITY;
    this.name = "ActivityLikeSingerAction";
  }

  _dealCall(caller, data) {
    caller.setState({
      likeStatus: 2,
    })
  }

  _dealFinishSucess(data, response) {
    this.caller.setState({
      likeStatus: 1,
      statusText:"投票成功",
      updateByLike:true,
    })
  }

  _dealFinishFailed(data, response) {
    let detail = "服务器错误";
    if(data && data.detail != undefined) {
      detail = data.detail;
    }
    this.caller.setState({
      likeStatus:1,
      statusText:"投票失败:" + detail + " " + response.status,
      updateByLike:true,
    })
  }
}
